package org.sippr.mapper;

import org.apache.ibatis.annotations.*;
import org.sippr.pojo.WordCls;

import java.util.List;

@Mapper
public interface WordClsMapper {
    @Select("select * from word_cls where name=#{name}")
    WordCls findByName(String name);

    @Insert("insert into word_cls(name, parent_id, create_user, update_user, create_time, update_time) " +
            "values(#{name},#{parentId}, #{createUser}, #{updateUser}, #{createTime}, #{updateTime})")
    void add(WordCls wordCls);

    @Update("update word_cls set name = #{name},update_user=#{updateUser}, update_time=#{updateTime} where id = #{id}")
    void update(WordCls wordCls);

    @Delete("delete from word_cls where id = #{id}")
    void delete(Integer id);

    @Select("select * from word_cls")
    List<WordCls> list();

    @Select("select * from word_cls where parent_id=#{parentId}")
    List<WordCls> getListByParentId(Integer parentId);
}
